#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int judge(int n)
{
	int a[n];
	int SUM = 0;
	for(int i = 0;i<n;i++)
	{
		scanf("%d",&a[i]);
		SUM += a[i];
	}
	int temp = a[0];
	int sum = a[0];
	for(int i = 1;i<n-1;i++)
	{
		temp = max((temp+a[i]),a[i]);
		//printf("%d\n",temp);
		if(sum<temp)
		{
			sum = temp;
		}
	}
//	printf("%d %d\n",SUM,sum);
	if(sum>=SUM) return 0;
	temp = a[1];
	sum = a[1];
	for(int i = 2;i<n;i++)
	{
		temp = max(temp+a[i],a[i]);
		if(sum<temp)
		{
			sum = temp;
		}
	}
	if(sum>=SUM) return 0;
	return 1;
}
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n;
		scanf("%d",&n);
		if(judge(n)) printf("YES\n");
		else printf("NO\n");
	}
} 
